FAIL(str(e))
return len(run['output'].splitlines())
+def get_state(domain_name, number):
+ s, o = traceCommand("xm network-list %s | awk '/^%d/ {print $5}'" %
+ (domain_name, number))
+ print o
+
+ if s != 0:
+ FAIL("network-list failed")
+ if o == "":
+ return 0
+ else:
+ return int(o)
+
def network_attach(domain_name, console):
eths_before = count_eth(console)
status, output = traceCommand("xm network-attach %s" % domain_name)
if status != 0:
return -1, "xm network-detach returned invalid %i != 0" % status
+ for i in range(10):
+ if get_state(domain_name, num) == 0:
+ break
+ time.sleep(1)
+ else:
+ FAIL("network-detach failed: device did not disappear")
+
eths_after = count_eth(console)
if eths_after != (eths_before-1):
return -2, "Network device was not actually disconnected from domU"